#ifndef SELECTIONRECT_H
#define SELECTIONRECT_H

#include <QColor>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include <iostream>
#include <QBrush>
#include <QDockWidget>
#include "selection.h"
#include <QSpinBox>
#include <QLabel>
#include <QPushButton>


class DrawingArea;

class SelectionRect : public Selection
{
    Q_OBJECT
public:
    //************************************************************* Constructor
    SelectionRect(DrawingArea* drawingAreaUse, QDockWidget* dockInfoTool);
    //************************************************************* SelectionRect movement
    void beginSelectionRect(int x, int y);
    void selectionningRect(int x, int y);
    void endSelectionRect(int x, int y);
    //************************************************************* Affichage of Dock Tool Info
    void infoOutilSelection(int xBegin, int yBegin,int xEnd, int yEnd);
    //************************************************************* Paint
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    Layer* imageSelected(Layer* layer, int posX, int posY);
    void refresh();

    QDockWidget* dockInfoTool;
    int realBeginX;
    int realBeginY;
    int realEndX;
    int realEndY;

 private:
    QSpinBox *spinXBegin;
    QSpinBox *spinXEnd;
    QSpinBox *spinYBegin;
    QSpinBox *spinYEnd;
    QPushButton* buttonValidTailleRect;
    QLabel *labelPointHautGauche;
    QLabel *labelTailleRectangle;
public slots:
    void changePositionRect();

};

#endif // SELECTIONRECT_H
